package com.sav.common.catalog;


public class Product {
	private int idProduct;
	private int idCategory;
	private String name;
	private String description;
	private int cost;
	private float weight;
	private int quantity;
	
	public Product() {
		
	}
	
	public Product(int idP, int idC, String n, String desc, int c, float w, int q) {
		idProduct = idP;
		idCategory = idC;
		name = n;
		description = desc;
		cost = c;
		weight = w;
		quantity = q;
	}
	
	public void setIdProduct(int id) {
		idProduct = id;
	}
	
	public int getIdProduct() {
		return idProduct;
	}
	
	public void setIdCategory(int id) {
		idCategory = id;
	}
	
	public int getIdCategory() {
		return idCategory;
	}
	
	public void setName(String n ) {
		name = n;
	}
	
	public String getName() {
		return name;
	}
	
	public void setDescription(String d) {
		description = d;
	}
	
	public String getDescription() {
		return description;
	}
	
	public void setCost(int c) {
		cost = c;
	}
	
	public int getCost() {
		return cost;
	}
	
	public void setWeight(float w) {
		weight = w;
	}
	
	public float getWeight() {
		return weight;
	}
	
	public void setQuantity(int q) {
		quantity = q;
	}
	
	public int getQuantity() {
		return quantity;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + cost;
		result = prime * result
				+ ((description == null) ? 0 : description.hashCode());
		result = prime * result + idCategory;
		result = prime * result + idProduct;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + quantity;
		result = prime * result + Float.floatToIntBits(weight);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Product other = (Product) obj;
		if (cost != other.cost)
			return false;
		if (description == null) {
			if (other.description != null)
				return false;
		} else if (!description.equals(other.description))
			return false;
		if (idCategory != other.idCategory)
			return false;
		if (idProduct != other.idProduct)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (quantity != other.quantity)
			return false;
		if (Float.floatToIntBits(weight) != Float.floatToIntBits(other.weight))
			return false;
		return true;
	}
	
}